/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_RTSP_AUTHENTICATOR_H
#define MK_RTSP_AUTHENTICATOR_H
#include "MkUtil/MkTypes.h"

class MkApi CMkRtspAuthenticator
{
public:
    CMkRtspAuthenticator();
    ~CMkRtspAuthenticator();
    const MkString& GetRealm()const { return m_Realm; }
    const MkString& GetNonce()const { return m_Nonce; }
    const MkString& GetUserName()const { return m_UserName; }
    const MkString& GetPassword()const { return m_Password; }
    const BOOL& GetIsMd5Pass()const { return m_bMd5Pass; }
    const BOOL& IsBasic() const { return m_bBasic; }

    Uint32 GetDigestResponse(const MkString& Method, const MkString& Uri, MkString& Response);
    Uint32 GetDigestRequest(MkString& WWWAuthenticate);
    Uint32 GetBasicResponse(MkString& Response);
    Uint32 GetBasicRequest(MkString& WWWAuthenticate);
    void SetUser(const MkString& UserName) { m_UserName = UserName; }
    void SetPassword(const MkString& Password, BOOL bMd5Pass) { m_Password = Password; m_bMd5Pass = bMd5Pass; }
    void SetRealm(const MkString& Realm) { m_Realm = Realm; }
    void SetNonce(const MkString& Nonce) { m_Nonce = Nonce; }
    void SetBasic(BOOL bBasic) { m_bBasic = bBasic; }

    BOOL operator==(const CMkRtspAuthenticator& Other);
protected:
private:
    MkString			m_Realm;
    MkString			m_Nonce;
    MkString			m_UserName;
    MkString			m_Password;
    BOOL				m_bMd5Pass;
    BOOL                m_bBasic;
};

#endif
